﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using IndoReputation.Models.BusinessObject;
using IndoReputation.Models.BusinessObject.Collections;
using IndoReputation.Models.DataAccess;

namespace IndoReputation.Models.BusinessLogic
{
    public class MediaReporterBOL
    {
        /// <summary>
        /// Author: Nguyen Duc Thanh Tung
        /// Created on: 4/22/2012  6:03 PM
        /// Todo: Insert an mediaReporter to db
        /// </summary>
        /// <param name="mediaReporter">The mediaReporter.</param>
        /// <returns></returns>
        public static int Insert(MediaReporter mediaReporter)
        {
            try
            {
                mediaReporter.CreateAt = DateTime.Now;
                mediaReporter.CreateBy = MySession.UserID;
                mediaReporter.UpdateAt = null;
                mediaReporter.UpdateBy = null;
                return MediaReporterDAL.Insert(mediaReporter);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }

        /// <summary>
        /// Author: Nguyen Duc Thanh Tung
        /// Created on: 11/30/2011  9:45 AM
        /// Todo: Update a User Exists in Database 
        /// </summary>
        /// <param name="mediaReporter">A mediaReporter.</param>
        /// <returns></returns>
        public static bool Update(MediaReporter mediaReporter)
        {
            try
            {
                mediaReporter.UpdateAt = DateTime.Now;
                mediaReporter.UpdateBy = MySession.UserID;
                return MediaReporterDAL.Update(mediaReporter);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }

        /// <summary>
        /// Author: Nguyen Duc Thanh Tung
        /// Created on: 11/30/2011  10:36 AM
        /// Todo: Delete a User Existst in Database
        /// </summary>
        /// <param name="mediaReporter">A mediaReporter.</param>
        /// <returns></returns>
        public static bool Delete(int mediaReporterID)
        {
            try
            {
                return MediaReporterDAL.Delete(mediaReporterID);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }

        /// <summary>
        /// Author: Nguyen Duc Thanh Tung
        /// Created on: 11/30/2011  10:36 AM
        /// Todo: Delete a User Existst in Database
        /// </summary>
        /// <param name="mediaReporter">A mediaReporter.</param>
        /// <returns></returns>
        public static bool Delete(int mediaID, int reporterID)
        {
            try
            {
                return MediaReporterDAL.Delete(mediaID, reporterID);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }

        /// <summary>
        /// Author: Nguyen Duc Thanh Tung
        /// Created on: 11/29/2011  5:23 PM
        /// Todo: Get All MediaReporter
        /// </summary>
        /// <returns></returns>
        public static MediaReporterList GetAllMediaReporter()
        {
            try
            {
                return MediaReporterDAL.GetAllMediaReporter() ?? new MediaReporterList();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }

        /// <summary>
        /// Author: Nguyen Duc Thanh Tung
        /// Created on: 11/30/2011  10:40 AM
        /// Todo: Select a User existst in Database
        /// </summary>
        /// <param name="mediaReporterID">The mediaReporter ID.</param>
        /// <returns></returns>
        public static MediaReporter GetMediaReporterById(int mediaReporterID)
        {
            try
            {
                return MediaReporterDAL.GetMediaReporterById(mediaReporterID);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
    }
}